class Solution(object):
    def lengthOfLongestSubstring(self, s):
        """
        :type s: str
        :rtype: int
        """
        i=j=n=0

        while j<len(s):

            if s[j] not in s[i:j]:
                j += 1
                n = max(n,j-i)
            else:
                i += 1
                       
        return n



s = "abcabcbb"
strrrr = Solution()
print(strrrr.lengthOfLongestSubstring(s))


